<% content_for :page_title do %>
  <h1>Shipit</h1>
<% end %>
<% content_for :primary_navigation do %>
  <%= link_to 'Add a stack', new_stack_path, class: 'btn secondary' %>
<% end %>

<div class="wrapper <%= 'filtering-enabled' if @stacks.size > 10 %>">
  <section>
    <header class="section-header stack-search-header">
      <input class="stack-search" placeholder="Search <%= @stacks.size %> stacks" />
    </header>
    <ul class="stack-table-header">
      <li class="col">Name</li>
      <li class="col">Environment</li>
      <li class="col">Branch</li>
      <li class="col">Deploy URL</li>
    </ul>
    <ul class="stack-lst">
      <% @stacks.each do |stack| %>
        <li class="search-item <%= stack.undeployed_commits? ? 'undeployed' : '' %> <%= @user_stacks.include?(stack.id) ? 'contributor' : 'not-matching' %>" data-search="<%= stack.repo_name %> <%= stack.environment %> <%= stack.deploy_url %>" data-stack-id="<%= stack.id %>">
          <%= link_to stack_path(stack), class: 'commits-path' do %>
            <span class="col"><%= stack.repo_name %></span>
            <small class="col"><%= stack.environment.capitalize %></small>
            <small class="col"><%= stack.branch %></small>
            <small class="col"><%= stack.deploy_url %></small>
          <% end %>
        </li>
      <% end %>
    </ul>

    <%= link_to 'show all stacks', '#', class: 'btn secondary show-all-stacks' %></p>
  </section>

</div>
